package com.chainyoung.component_tmperson.ui.mvp.presenter;

import com.chainyoung.common.base.CommonSubscriber;
import com.chainyoung.common.mvp.BasePresenter;
import com.chainyoung.common.utils.RxUtils;
import com.chainyoung.component_tmperson.ui.mvp.contract.AboutProtocolContact;
import com.chainyoung.component_tmperson.ui.mvp.contract.DebitContractContract;

import java.util.TreeMap;

import javax.inject.Inject;

public class DebitContractPresenter extends BasePresenter<DebitContractContract.Model, DebitContractContract.View> {

    @Inject
    public DebitContractPresenter(DebitContractContract.Model model, DebitContractContract.View rootView) {
        super(model, rootView);
    }


    public void getDebitContract(TreeMap<String, Object> map) {
        addSubscribe(mModel.getDebitContract(map)
                .compose(RxUtils.<String>rxSchedulerHelper())
                .subscribeWith(new CommonSubscriber<String>(mView) {
                    @Override
                    public void onNext(String data) {
                        mView.showDebitContract(data);
                    }

                    @Override
                    public void onError(Throwable e) {
                        super.onError(e);
                    }
                }));
    }


}

